package com.dong.rwmysql.mapper;

import com.dong.rwmysql.bean.UserEntity;
import org.apache.ibatis.annotations.*;
import java.util.List;

/**
 * Spring通过@Mapper注解实现动态代理，mybatis会自动创建Dao接口的实现类代理对象注入IOC容器进行管理，这样就不用编写Dao层的实现类
 */
@Mapper
public interface UserMapper {

    @Select("SELECT * FROM user2")
    List<UserEntity> findAll();

    @Insert("insert into user2(user_id,account,nickname,password) values(#{user_id},#{account}, #{nickname}, #{password})")
    int insert(UserEntity user);

//    @Update("UPDATE user2 SET account=#{account},nickname=#{nickname} WHERE id =#{id}")
//    void update(UserEntity user);
//
//    @Delete("DELETE FROM user2 WHERE id =#{id}")
//    void delete(Long id);
}

